import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
// import { terser } from "rollup-plugin-terser";

export default defineConfig({
  plugins: [
    vue(),
    // terser({
    //   format: {
    //     comments: false,
    //   },
    //   compress: {
    //     drop_console: true,
    //     drop_debugger: true,
    //   },
    // }),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  server: {
    cors: true, // 允许跨域
    hmr: true, // 开启热更新
    headers: {
      "Cross-Origin-Opener-Policy": "same-origin",
      "Cross-Origin-Embedder-Policy": "require-corp",
    },
  },
  base: "./", //配合electron打包
});
